package com.xianbeiying.app.ckgl.activity;

import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;

import com.nostra13.universalimageloader.core.ImageLoader;
import com.xianbeiying.app.ckgl.MyApplication;
import com.xianbeiying.app.ckgl.R;
import com.xianbeiying.app.ckgl.bean.UrlBean;
import com.xianbeiying.app.ckgl.widght.MyImageBrowser;

/**
 * 查看大图
 */
public class LookBigPictureActivity extends BaseActivity implements View.OnClickListener, MyImageBrowser.OnDongzuoListener {
    private MyImageBrowser imageBrowser;
    public static String ITEN_KEY_DELABLE = "ITEN_KEY_DELABLE"; //是否具有删除照片的按钮
    public static String ITEN_KEY_IMGS = "ITEN_KEY_IMGS";
    public static String ITEN_KEY_CPAGE = "ITEN_KEY_CPAGE";
    private int cpage;
    private String[] imageFiles =new String[0];
    private ImageView imageview;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_imagebrowser);
        init();
    }

    private void init(){
        imageview=(ImageView)findViewById(R.id.imageview);
        imageBrowser = (MyImageBrowser) findViewById(R.id.myImageBrowser);
        initData();
    }
    private void initData(){
        cpage = this.getIntent().getIntExtra(ITEN_KEY_CPAGE, 0);
        imageBrowser.setPageChgLst(this);
        initImageBrowser();
    }
    private void initImageBrowser(){
//        Bitmap bitmap= BitmapFactory.decodeResource(getResources(), R.mipmap.img_default4);
//        imageBrowser.setImages(imageFiles,0);
//        imageview.setImageResource(R.mipmap.img_default4);
        ImageLoader.getInstance().displayImage("http://"+ MyApplication.IP+ UrlBean.IMAGES+getIntent().getStringExtra("imgUrl"), imageview);
    }
    @Override
    public void onClick(View v) {

    }
    @Override
    public void onPageChange(int cPage) {

    }
    @Override
    public void onSigclicked(View v) {
        this.finish();
        this.overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
    }

    @Override
    protected void onDestroy() {
        imageBrowser.release();
        imageBrowser = null;
        super.onDestroy();
    }
}
